home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 008a / feb93cad.zip / ACAD.LSP < prev    next >
Lisp/Scheme  |  1993-02-12  |  4KB  |  125 lines

  1. ; ACAD.LSP
  2. ;; General AutoLisp Command File 
  3. ;; Version 4.0
  4. ;; (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
  5. ;; BURNS & McDONNELL Engineering Company
  6. ;; 4800 E. 63rd Street
  7. ;; Kansas City, Mo.  64130
  8. ;; 816-333-4375
  9. ;;
  10. ;; By: Mark Scott - MicroCAD Applications Programmer
  11.  
  12. (vmon)
  13.  
  14. (setvar "cmdecho" 0)
  15. (defun dtr(a) (* pi (/ a 180.0)))
  16. (defun rtd(a) (* (/ a pi) 180.0))
  17.  
  18. (defun s_vars ()
  19.    (setq sv_cmd (getvar "cmdecho")
  20.          sv_blip (getvar "blipmode")
  21.          sv_high (getvar "highlight")
  22.          sv_drag (getvar "dragmode")
  23.    )
  24. )
  25. (defun r_vars ()
  26.    (setvar "blipmode" sv_blip)
  27.    (setvar "highlight" sv_high)
  28.    (setvar "dragmode" sv_drag)
  29.    (setvar "cmdecho" sv_cmd)
  30.    (princ)
  31. )
  32. ;;;
  33. ;;; AutoLOAD error function
  34. ;;;
  35. (defun alerror (s)
  36.   (if (/= s "Function cancelled")
  37.     (progn
  38.       (princ (strcat "\nAutoload error on line " (itoa linenum)))
  39.       (princ (strcat "\nError: " s "  in file " val))
  40.       (princ "\nCannot continue loading files...")
  41.     )
  42.   )
  43.   (setq S nil)                        
  44.   (setq *error* origerr)               ; Restore old *error* handler
  45.   (prin1)
  46. )
  47. ;;;
  48. ;;; AutoLOAD
  49. ;;;
  50. (defun autoload ()
  51.    (setq origerr *error*
  52.          *error* alerror)
  53.    ;; Look for file autoload.lst in c:\acad\support
  54.    (setq chk4alf nil
  55.          chk4alf (findfile "autoload.lst")
  56.          linenum 0
  57.    )
  58.    (if (not chk4alf)
  59.       ;;THEN
  60.       (princ "\n*ERROR* autoload.lst file not found ...")
  61.       ;;ELSE
  62.       (progn
  63.          (setq alf (open chk4alf "r"))
  64.          (while (setq val (read-line alf)) ;; Read the next line in file
  65.             (setq val (strcase val))
  66.             (if (= (substr val 1 1) ";")  ; = Commented portion of file
  67.                ;;THEN
  68.                (setq linenum (1+ linenum))
  69.                ;;ELSE
  70.                (progn
  71.                   (setq linenum (1+ linenum))
  72.                   (setq sl (strlen val))
  73.                   (if (/= (substr val (- sl 3) 1) ".")
  74.                      ;;THEN
  75.                      (princ (strcat "\n*ERROR* in line " (itoa linenum)  " of
  76. autoload.lst file, no extension. "))
  77.                      ;;ELSE
  78.                      (progn
  79.                         (setq ext (substr val (- sl 2)))
  80.                         (cond
  81.                            ((= ext "LSP")
  82.                               (progn
  83.                                  (princ (strcat "\nLoading  " val " ..."))
  84.                                  (load val)
  85.                               )
  86.                            )
  87.                            ((= ext "EXP")
  88.                               (progn
  89.                                  (princ (strcat "\nXLoading " val " ..."))
  90.                                  (xload val)
  91.                               )
  92.                            )
  93.                            (t (progn
  94.                                  (princ (strcat "\nError on line "
  95.                                        (itoa linenum)))
  96.                                  (princ (strcat " in file Autoload.lst [" val
  97. "]"))
  98.                                  (princ "\nInvalid extension type")
  99.                                  (getstring "... press Return to continue ...")
  100.                               )
  101.                            )
  102.                         )
  103.                      )
  104.                   )
  105.                )
  106.             )
  107.          )
  108.       )
  109.    )
  110.    (close alf)
  111.    (setq *error* origerr)
  112.    (princ "\nAll files in AUTOLOAD.LST  have been loaded ...")
  113.    (prin1)
  114. )
  115.  
  116. (autoload)      ;; calls AutoLOAD after loading
  117. (setq autoload nil)     ;; frees up memory not needed by autoload anymore...
  118. (princ "\nBurns & McDonnell - ACAD.LSP - Release 11 - 1992")
  119. (prin1)
  120.  
  121.  
  122.  
  123.  
  124.  
  125.